1. Technical Field
The present invention relates to an encoding method, an encoding device, an encoding process program, and a recording medium on which the encoding process program is recorded, and is applicable to video cameras, for example. The present invention encodes input image data on the basis of a true predicted code quantity calculated by correcting a roughly calculated predicted code quantity, predicted from the input image data, with a correction coefficient and sets the correction coefficient of a corresponding picture type on the basis of an actual generated code quantity. The present invention makes it possible to allocate an appropriate code quantity to each picture when a recording time is to be guaranteed by a one-pass system, and when there are many prediction modes, accordingly.
2. Background Art
Conventionally, VBR (Variable Bit Rate) encoding control and CBR (Constant Bit Rate) encoding control are widely known in motion-compensated predictive coding. The VBR encoding control is a method of encoding a moving image by a fixed quantization scale set in advance. On the other hand, the CBR encoding control is a method of performing encoding control while changing the quantization scale so that a generated code quantity becomes a predetermined target value.
The VBR encoding control changes the generated code quantity in various manners according to an object being processed, and therefore cannot guarantee a recordable time when moving images are recorded onto a recording medium. Therefore, in recording moving images or the like, a recording time is guaranteed mainly by the CBR encoding control.
However, the CBR encoding control may encode a picture, which can be coded easily, with an unnecessarily high picture quality, and is thus still practically unsatisfactory in terms of encoding efficiency. Japanese Patent Laid-open No. 2001-28753, for example, proposes a method for improving encoding efficiency by performing an encoding process with switching between the VBR encoding control and the CBR encoding control.
In the CBR encoding control, there are a so-called two-pass system in which a tentative encoding process is performed by a fixed quantization scale and a generated code quantity is measured, and a quantization scale is varied according to a result of the measurement and an actual encoding process is performed, and a so-called one-pass system in which a quantization scale is varied in real time while a generated code quantity is predicted. The one-pass system requires an amount of operation that is about ½ of that of the two-pass system, and can process moving pictures in real time. The one-pass system is therefore employed in various recording devices.
However, the one-pass system is still practically unsatisfactory in terms of allocating an appropriate code quantity to each picture and encoding moving pictures with high picture quality.
Specifically, the one-pass system varies the quantization scale by feedback control according to the generated code quantity, and can thus adjust a compression ratio only after one picture is encoded. Thus, it is difficult to vary the quantization scale so as to follow changes in picture quality well, so that allocation of an appropriate code quantity is not necessarily performed when the code quantity of each picture is observed.
A method proposed to solve this problem detects a feature quantity indicating a degree of difficulty of an encoding process, such for example as a high-frequency component, for each picture, and controls the quantization scale by feedforward control with a result of the detection as a basis. This method can generally allocate an appropriate code quantity to each picture in an encoding process of MPEG-2, for example.
However, encoding methods of this type include methods in which an optimum prediction mode is selected from many prediction modes and an encoding process is performed, such as H.264/AVC (Advanced Video Coding) and MPEG (Moving Picture Experts Group)-4. In such encoding methods, a correlation between the feature quantity and the generated code quantity is significantly reduced. Thus, even with the methods, it is difficult to allocate an appropriate code quantity in an encoding process in which there are such a large number of prediction modes.